import 'package:flutter/material.dart';
import 'package:untitled5/chat_page.dart';
import 'package:untitled5/discover_page.dart';
import 'package:untitled5/friends_page.dart';
import 'package:untitled5/me_page.dart';

class Page0 extends StatefulWidget {
  const Page0({super.key});

  @override
  State<Page0> createState() => _Page0State();
}

class MeAppBar {}

class _Page0State extends State<Page0> {
  PageController _pageController = PageController();
  int _currentIndex = 0;
  List _PageTitle = ['微信', '通讯录', '发现', ''];
  List<double> _h = [50, 50, 50, -58];
  @override
  void dispose() {
    _pageController.dispose();
    super.dispose();
  }

  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
      //   backgroundColor: Color.fromRGBO(220, 220, 220, 1),
      //   elevation: 0,
      //   title: Text('${_PageTitle[_currentIndex]}'),
      // ),
      body: Container(
        child: PageView(
          controller: _pageController,
          onPageChanged: (index) {
            setState(() {
              _currentIndex = index;
            });
          },
          children: [ChatPage(), FriendsPage(), DiscoverPage(), MePage()],
        ),
      ),
      // body: _Pages[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        selectedFontSize: 12.0,
        onTap: (index) {
          _pageController.jumpToPage(
            index,
          );
        },
        type: BottomNavigationBarType.fixed,
        fixedColor: Colors.green,
        currentIndex: _currentIndex,
        items: const [
          BottomNavigationBarItem(
              icon: Icon(
                Icons.chat,
                color: Colors.black,
              ),
              activeIcon: Icon(
                Icons.chat,
                color: Colors.green,
              ),
              label: '微信'),
          BottomNavigationBarItem(
              icon: Image(
                  width: 25,
                  height: 25,
                  image: AssetImage('images/friends.png')),
              activeIcon: Image(
                  width: 25,
                  height: 25,
                  image: AssetImage('images/friendsgreen.png')),
              label: '通讯录'),
          BottomNavigationBarItem(
              icon: Image(
                  height: 25,
                  width: 25,
                  image: AssetImage('images/discover.png')),
              activeIcon: Image(
                  height: 25,
                  width: 25,
                  image: AssetImage('images/discovergreen.png')),
              label: '发现'),
          BottomNavigationBarItem(
              icon: Image(
                  height: 25, width: 25, image: AssetImage('images/me.png')),
              activeIcon: Image(
                  height: 25,
                  width: 25,
                  image: AssetImage('images/megreen.png')),
              label: '我'),
        ],
      ),
    );
  }
}
